function [ idx ] = findCurveEndIdx ( primaryBody, secondaryBody, qualifier, colIdx )
%Finds the index within the primary data set where value replacement
% should end


if size(secondaryBody) == [0,0]
    
    error('flow:findCurveEndIdx:fitMustReachZero', ...
        'Polynomial fit must touch the x-axis at least once after systole ejection period. Please try again and ensure this occurs.');

end

idx = find(primaryBody(:, 1) == qualifier(secondaryBody(:, 1)));

end

